/**
 * 0131
 *  
 * @Author : roryrywang
 * @DateTime : 2024/8/15 23:25
 */

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

class Solution {
public:
    vector<string> tmp;
    vector<vector<string>> res;

    bool check(const string &s, int l, int r) {
        for (int i = l, j = r; i < j; ++i, --j) {
            if (s[i] != s[j])return false;
        }
        return true;
    }

    void dfs(string s, int x) {
        if (x == s.size()) {
            res.push_back(tmp);
            return;
        }
        for (int i = x; i < s.size(); ++i) {
            if (check(s, x, i)) {
                tmp.push_back(s.substr(x, i - x + 1));
                dfs(s, i + 1);
                tmp.pop_back();
            }
        }
    }

    vector<vector<string>> partition(string s) {
        dfs(s, 0);
        return res;
    }
};

int main() {

    return 0;
}